package com.zhou.yygh.oss.controller;

import com.zhou.yygh.common.result.Result;
import com.zhou.yygh.oss.service.FileUploadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;


@RequestMapping("/api/oss/file")
@RestController
@Api(tags = "文件上传")
public class FileApiController {
    @Autowired
    private FileUploadService fileUploadService;

    @PostMapping("/fileUpload")
    @ApiOperation(value = "上传文件到本地")
    public Result fileUpload(MultipartFile file) {
        String url = fileUploadService.upload(file);
        return Result.ok(url);
    }

}
